export enum APIResponseCode {
    OK = 200,
    CREATED = 201,
    ACCEPTED = 202,
    NO_CONTENT = 204,
    BAD_REQUEST = 400,
    UNAUTHORIZED = 401,
    FORBIDDEN = 403,
    NOT_FOUND = 404,
    METHOD_NOT_ALLOWED = 405,
    CONFLICT = 409,
}

export class APIResponse {
    public static ok<T>(data: T, message: string=''): string {
        return JSON.stringify({
            code: APIResponseCode.OK,
            data,
            message: message || 'OK',
        });
    }
}